namespace CVBanc.Migrations
{
    using CVBanc.Models;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<CVBanc.Models.Context>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(CVBanc.Models.Context ctx)
        {
            var users = ctx.Users.ToList() ; 
            
            users.ForEach(x=>ctx.Users.Remove(x));
            ctx.SaveChanges();
            ctx.Users.AddOrUpdate(
                new User { Firstname = "Sami", Lastname = "Antari", Engineering = Data_Model.Constants.engineering_civil, Keywords = "fourage;structure", Password = "12", Username = "sa" },
                new User { Firstname = "Karim", Lastname = "Benzema", Engineering = Data_Model.Constants.engineering_meca, Keywords = "dynamique;catia", Password = "12", Username = "kb" },
                new User { Firstname = "Emine", Lastname = "Bentaieb", Engineering = Data_Model.Constants.engineering_log, Keywords = "sql;csharp", Password = "12", Username = "eb" }
                );
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
        }
    }
}
